package sample.spring.ibatis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sample.spring.ibatis.model.User;
import sample.spring.ibatis.service.IUserService;

import java.util.List;
import java.util.Map;

/**
 * Created by yangyang on 15/10/2.
 */
@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    IUserService userService;

    @RequestMapping(method = RequestMethod.GET)
    public List<User> getAllUser() {
        return userService.getAllUsers();
    }

    @RequestMapping("/")
    public String welcome(Map<String, Object> model) {
        return "index";
    }
}
